<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="html" omit-xml-declaration="yes" />
	<xsl:template match="/">
		<html>
			<head>
				<link rel="stylesheet" type="text/css" href="css/screen.css" />
				<title>Chupacabra :: Employee list</title>
			</head>
			<body>
				<div id="header">
					<ul>
						<li class="inactive">
							<a href="/peaa/jobs.htm">Jobs</a>
						</li>
						<li class="inactive">
							<a href="/peaa/departments.htm">Departments</a>
						</li>
						<li class="inactive">
							<a href="/peaa/employees.htm">Employees</a>
						</li>
					</ul>
				</div>
				<div class="clear" />
				<div class="error">
					<xsl:value-of select="employee_details/error_message" />
				</div>
				<div id="content">
					<h1>Employee Details</h1>
					<form name="employee_details" method="post">
						<fieldset class="employee_details">
							<div>
								<label>Id</label>
								<input type="text" name="id" disabled="true">
									<xsl:attribute name="value"><xsl:value-of
										select="employee_details/employee/id" /></xsl:attribute>
								</input>
							</div>
							<div class="clear" />
							<div>
								<label>First name</label>
								<input type="text" name="first_name">
									<xsl:attribute name="value"><xsl:value-of
										select="employee_details/employee/first_name" /></xsl:attribute>
								</input>
							</div>
							<div class="clear" />
							<div>
								<label>Last name</label>
								<input type="text" name="last_name">
									<xsl:attribute name="value"><xsl:value-of
										select="employee_details/employee/last_name" /></xsl:attribute>
								</input>
							</div>
							<div class="clear" />
							<div>
								<label>Email</label>
								<input type="text" name="email">
									<xsl:attribute name="value"><xsl:value-of
										select="employee_details/employee/email" /></xsl:attribute>
								</input>
							</div>
							<div class="clear" />
							<div>
								<label>Phone</label>
								<input type="text" name="phone">
									<xsl:attribute name="value"><xsl:value-of
										select="employee_details/employee/phone" /></xsl:attribute>
								</input>
							</div>
							<div class="clear" />
							<div>
								<label>Hire Date</label>
								<input type="text" name="hire_date">
									<xsl:attribute name="value"><xsl:value-of
										select="employee_details/employee/hire_date" /></xsl:attribute>
								</input>
							</div>
							<div class="clear" />
							<div>
								<label>Job</label>
								<select name="job_id">
								    <xsl:variable name="selected_id" select="employee_details/employee/job_id" />
									<xsl:for-each select="employee_details/jobs/job">
										<xsl:choose>
											<xsl:when test="id=$selected_id">
												<option selected="true">
													<xsl:attribute name="value"><xsl:value-of
														select="id" /></xsl:attribute>
													<xsl:value-of select="title" />
												</option>
											</xsl:when>
											<xsl:otherwise>
												<option>
													<xsl:attribute name="value"><xsl:value-of
														select="id" /></xsl:attribute>
													<xsl:value-of select="title" />
												</option>
											</xsl:otherwise>
										</xsl:choose>

									</xsl:for-each>
								</select>
							</div>
							<div class="clear" />
							<div>
								<label>Salary</label>
								<input type="text" name="salary">
									<xsl:attribute name="value"><xsl:value-of
										select="employee_details/employee/salary" /></xsl:attribute>
								</input>
							</div>
							<div class="clear" />
							<div>
								<label>Commission point</label>
								<input type="text" name="commission_pct">
									<xsl:attribute name="value"><xsl:value-of
										select="employee_details/employee/commission_pct" /></xsl:attribute>
								</input>
							</div>
							<div class="clear" />
							<div>
								<label>Manager Id</label>
								<input type="text" name="manager_id">
									<xsl:attribute name="value"><xsl:value-of
										select="employee_details/employee/manager_id" /></xsl:attribute>
								</input>
							</div>
							<div class="clear" />
							<div>
								<label>Department Id</label>
								<input type="text" name="department_id">
									<xsl:attribute name="value"><xsl:value-of
										select="employee_details/employee/department_id" /></xsl:attribute>
								</input>
							</div>
							<br />
							<input type="submit" value="Update" />
							<input type="button" value="Employees"
								onclick="window.location='employees.htm'" />
						</fieldset>
					</form>
				</div>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>